import { request } from "@/api/service";
import { BUTTON_STATUS_NUMBER } from "@/config/button";
import { urlPrefix as complaintsPrefix } from "./api";


export const crudOptions = vm => {
  return {
    pageOptions: {
      compact: true,
      export: {
        local: true,//本地导出，false为服务端导出
      },
    },
    options: {
      tableType: "vxe-table",
      rowKey: true, // 必须设置，true or false
      rowId: "id",
      height: "100%", // 表格高度100%, 使用toolbar必须设置
      highlightCurrentRow: false
    },
    rowHandle: {
      width: 140,
      view: {
        thin: true,
        text: "",
        disabled() {
          return !vm.hasPermissions("Retrieve");
        }
      },
      edit: {
        thin: true,
        text: "",
        disabled() {
          return !vm.hasPermissions("Update");
        }
      },
      remove: {
        thin: true,
        text: "",
        disabled() {
          return !vm.hasPermissions("Delete");
        }
      }
    },
    indexRow: {
      // 或者直接传true,不显示title，不居中
      title: "序号",
      align: "center",
      width: 100
    },
    viewOptions: {
      componentType: "form"
    },
    formOptions: {
      defaultSpan: 24, // 默认的表单 span
      width: "35%"
    },
    columns: [{
      title: "ID",
      key: "id",
      show: false,
      disabled: true,
      width: 90,
      form: {
        disabled: true
      }
    },
    {
      title: "案件所属系统",
      key: "案件所属系统",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "案件所属系统必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入案件所属系统"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "案件编号",
      key: "案件编号",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "案件编号必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入案件编号"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "案件名称",
      key: "案件名称",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "案件名称必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入案件名称"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "案由",
      key: "案由",
      width: 300,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "案由必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入案由"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "案值_万元_field",
      key: "案值(万元)",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "number",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "案值_万元_field必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入案值_万元_field"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "当事人",
      key: "当事人",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      search: {
        component: {
          props: {
            clearable: true
          }
        }
      },
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "当事人必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入当事人"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "当事人类型",
      key: "当事人类型",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "当事人类型必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入当事人类型"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "身份证号",
      key: "身份证号",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "身份证号必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入身份证号"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "注册号",
      key: "注册号",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "注册号必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入注册号"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "性别",
      key: "性别",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "性别必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入性别"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "法人",
      key: "法人",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "法人必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入法人"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "职业",
      key: "职业",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "职业必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入职业"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "地址",
      key: "地址",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "地址必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入地址"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "工作单位",
      key: "工作单位",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "工作单位必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入工作单位"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "居所",
      key: "居所",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "居所必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入居所"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "立案日期",
      key: "立案日期",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "date",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "立案日期必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入立案日期"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "案发日期",
      key: "案发日期",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "date",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "案发日期必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入案发日期"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "案发地",
      key: "案发地",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "案发地必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入案发地"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "主要发案区域",
      key: "主要发案区域",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      search: {
        component: {
          props: {
            clearable: true
          }
        }
      },
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "主要发案区域必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入主要发案区域"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "立案机关",
      key: "立案机关",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "立案机关必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入立案机关"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "办案机构",
      key: "办案机构",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "办案机构必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入办案机构"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "违法行为种类",
      key: "违法行为种类",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "违法行为种类必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入违法行为种类"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "案件认定事实",
      key: "案件认定事实",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "案件认定事实必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入案件认定事实"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "非法所得_万元_field",
      key: "非法所得_万元_field",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "number",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "非法所得_万元_field必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入非法所得_万元_field"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "作出处理决定日期",
      key: "作出处理决定日期",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "作出处理决定日期必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入作出处理决定日期"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "处罚书文号",
      key: "处罚书文号",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "处罚书文号必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入处罚书文号"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "处罚种类",
      key: "处罚种类",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "处罚种类必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入处罚种类"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "处罚决定书送达日期",
      key: "处罚决定书送达日期",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "处罚决定书送达日期必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入处罚决定书送达日期"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "定性依据",
      key: "定性依据",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "定性依据必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入定性依据"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "处罚依据",
      key: "处罚依据",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "处罚依据必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入处罚依据"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "执法人员",
      key: "执法人员",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "执法人员必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入执法人员"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "主办人",
      key: "主办人",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "主办人必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入主办人"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "罚款金额_万元_field",
      key: "罚款金额_万元_field",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "number",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "罚款金额_万元_field必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入罚款金额_万元_field"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "没收金额_万元_field",
      key: "没收金额_万元_field",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "number",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "没收金额_万元_field必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入没收金额_万元_field"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "罚没入库金额_万元_field",
      key: "罚没入库金额_万元_field",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "number",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "罚没入库金额_万元_field必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入罚没入库金额_万元_field"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "案件处理类型",
      key: "案件处理类型",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "案件处理类型必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入案件处理类型"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "案件状态",
      key: "案件状态",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      search: {
        component: {
          props: {
            clearable: true
          }
        }
      },
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "案件状态必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入案件状态"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "案件类别",
      key: "案件类别",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      search: {
        component: {
          props: {
            clearable: true
          }
        }
      },
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "案件类别必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入案件类别"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "结案日期",
      key: "结案日期",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "结案日期必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入结案日期"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "适用程序",
      key: "适用程序",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "适用程序必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入适用程序"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "专项工作",
      key: "专项工作",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "专项工作必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入专项工作"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "是否四个最严案件",
      key: "是否四个最严案件",
      width: 150,
      sortable: true,
      treeNode: true,

      type: "input",
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "是否四个最严案件必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入是否四个最严案件"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    ].concat(vm.commonEndColumns())
  };
};
